/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package object;

import java.util.TimerTask;
import ui.GamePanel;

/**
 *
 * @author XiaoLong
 */
public class TetrisTask extends TimerTask {
    //主界面对象
    private GamePanel gamePanel;

    public TetrisTask(GamePanel gamePanel) {
        this.gamePanel = gamePanel;
    }

    @Override
    public void run() {
        //判断快整下降后是否有障碍或者到底部
        if (this.gamePanel.control.isBlock() || this.gamePanel.control.isButtom()) {
            this.gamePanel.showNext();
            return;
        }
        //得到当前正在运动的大方块
        this.gamePanel.getPiece().setSquaresYLocation(Piece.SQUARE_BORDER);
        this.gamePanel.repaint();
    }
}
